import request from "./useRequests";
import { userinfo } from '@/stores/counter'
import getComment from './getUser'

export default function getComments() {
  const user = userinfo()
  async function comments(articalId: string) {
    try {
      const res = await request({
        method: "get",
        url: `comment/`+articalId
      })
      // console.log(res.data.data.length)
      user.curComment = res.data.data
      // user.comments = await getComment().getComments()
    } catch (err: any) {
      //alert(err)
    }
  }

  return {
    comments
  }
}